package com.qyt.hotel.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> implements Serializable {
    private String message;//返回消息
    private boolean success;//是否成功
    private String token;
    private Integer code;//返回码
    private T data;//返回数据

    public static final Result<?> SUCCESS = new Result("SUCCESS", true, 0);

    public static final Result<?> ERROR = new Result("ERROR", false, 1000);

    public Result(String message, boolean success, Integer code) {
        this.message = message;
        this.success = success;
        this.code = code;
    }

    public Result(String message, boolean success, Integer code, T data) {
        this.message = message;
        this.success = success;
        this.code = code;
        this.data = data;
    }


}
